__author__ = 'East'

import json
import pickle   # 和json完全相同,文件操作用wb rb文件二进制

def sayhi(name):
    print('hello', name)

info = {
    'name' : 'alex',
    'age' : 22,
    'func' : sayhi
}

with open('test.txt', 'w') as f:
    f.write(json.dumps(info))